﻿using UnityEngine;
using System.Collections;

public class Beacon : MonoBehaviour 
{
    public float proximity;
    public bool autoAtStart = true;
    public bool autoAlways = false;

    public Triangulation triangulationObj;

    void Start()
    {
        if (autoAtStart)
        {
            UpdateProximity();
        }
    }

    void Update()
    {
        if (autoAlways)
        {
            UpdateProximity();
        }
    }

    void UpdateProximity()
    {
        proximity = Vector2.Distance(triangulationObj.transform.position, transform.position);
    }
}
